package com.pomr.model.equipmentstorage;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;

import com.alibaba.fastjson.annotation.JSONField;
import com.pomr.model.sys.User;

/**
 * 定金收据
 * @author Administrator
 *
 */
@Entity
@Table(name="receive_recipt")
public class ReceiveRecipt implements Serializable{
	public User getReceiptUser() {
		return receiptUser;
	}

	public void setReceiptUser(User receiptUser) {
		this.receiptUser = receiptUser;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public double getMoney() {
		return money;
	}

	public void setMoney(double money) {
		this.money = money;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Receive getReceice() {
		return receice;
	}

	public void setReceice(Receive receice) {
		this.receice = receice;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
    @GenericGenerator(name = "native", strategy = "native")//AUTO 在mysql中需要指定使用本地策略生成主键值
	private Integer id;//主键
	
	@Column(name="money")
	private double money;//金额

	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
	@Column(name="createTime")
	private Date createTime;//收费时间
	
	/**
     * @ManyToOne 使用此标签建立多对一关联，此属性在“多”方使用注解在我们的“一”方属性上
     * @cascade 指定级联操作，以数组方式指定，如果只有一个，可以省略“{}” 多的一方不设置级联
     * @fetch 定义抓取策略
     * @optional 定义是否为必需属性，如果为必需（false），但在持久化时user = null,则会持久化失败
     * @targetEntity 目标关联对象，默认为被注解属性所在类
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "receice_id",unique = false,updatable = false)
    private Receive receice;
    
    
    @ManyToOne
	@JoinColumn(name="receiptUser")
	private User receiptUser;//收款人
	

}
